/**
 * 
 */
package IC.AST.nodes;

import java.util.EnumSet;

/**
 * the operators in the language
 *
 */
public enum Operator {
	PLUS("+"),
	MINUS("-"),
	MUL("*"),
	DIV("/"),
	MOD("%"),
	AND("&&"),
	OR("||"),
	EQ("=="),
	NEQ("!="),
	GT(">"),
	GTE(">="),
	LT("<"),
	LTE("<="),
	LNEG("!");

	String rep;

	private Operator(String s) {
		this.rep = s;
	}

	public String toString() {
		return rep;
	}

	public static EnumSet<Operator> BinaryMathOps = 
		EnumSet.of(Operator.PLUS, Operator.MINUS, Operator.DIV, 
				Operator.MUL, Operator.MOD);

	public static EnumSet<Operator> LtGtOps = 
		EnumSet.of(Operator.LT, Operator.LTE, 
				Operator.GT, Operator.GTE);

	public static EnumSet<Operator> EqNEqOps = 
		EnumSet.of(Operator.EQ, Operator.NEQ);

	public static EnumSet<Operator> AndOrOps = 
		EnumSet.of(Operator.AND, Operator.OR);

	public static EnumSet<Operator> BoolOps =
		EnumSet.of(Operator.AND, Operator.OR, Operator.EQ, Operator.NEQ,
				Operator.LT, Operator.LTE, Operator.GT, Operator.GTE);

	public static EnumSet<Operator> CommutativeOps =
		EnumSet.of(Operator.AND, Operator.OR, Operator.EQ, Operator.NEQ,
				Operator.PLUS, Operator.MUL);

	public static EnumSet<Operator> PlusMinusOps =
		EnumSet.of(Operator.PLUS, Operator.MINUS);

	public static EnumSet<Operator> MulDivOps =
		EnumSet.of(Operator.DIV, Operator.MUL, Operator.MOD);
}
